import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wangziyi/pages/app_my/app_address/view.dart';

import 'app_seting_logic.dart';
import 'app_seting_state.dart';

class AppSetingPage extends StatelessWidget {
  final AppSetingLogic logic = Get.put(AppSetingLogic());
  final AppSetingState state = Get.find<AppSetingLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('设置'),
        centerTitle: true,
      ),
      body: Container(
        child: ListView.separated(
            itemBuilder: (context, index) {
              if (index == 0) {
                return ListTile(
                  leading: ClipOval(
                    child: Image.asset('assets/images/touxiang.png'),
                  ),
                  title: Text('wangziyi',maxLines: 1,style: TextStyle(fontSize: 18,fontWeight: FontWeight.w900),),
                  subtitle: Text('我就是我，不一样的烟火！'),

                );
              }
              index-=1;
              return ListTile(
                title: Text(state.setTitles[index],textAlign: index==9||index==10?TextAlign.center:TextAlign.start,),
                trailing: Icon(Icons.chevron_right),
                onTap: (){
                  if(index==0){
                    Get.to(()=>AppAddressPage());
                  }
                },
              );
            },
            separatorBuilder: (context, index) {
              if (index == 1 || index == 3 || index == 7 || index == 9) {
                return Divider(
                  height: 10,
                  thickness: 10,
                );
              }
              return Divider(
                height: 0,
              );
            },
            itemCount: state.setTitles.length+1),
      ),
    );
  }
}
